<template>
  <div style="display:contents;" :style="{borderRadius:borderRadius}">
    <img :style="{height:height,width:width}" v-if="cover == ''" src="@/assets/images/3.png" alt="">
    <img :style="{height:height,width:width}" v-else :src="'http://127.0.0.1:100/'+cover" @error="defImg" alt="">
  </div>  
</template>

<script>
export default {
  props:{
    cover:{
      type:String,
      default:''
    },
    height:{
      type:String,
      default:''
    },
    width:{
      type:String,
      default:""
    },
    borderRadius:{
      type:String,
      default:'unset'
    }
  },
  methods:{
    defImg(event){
      let img = event.srcElement
      img.src = require('@/assets/images/头像.png')
      img.onerror = null
    }
  }
}
</script>

<style lang="scss" scoped>
img{
  width: 100%;
  height: 100%;
  display: block;
  // image-rendering: auto;
}
</style>